﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using DataAccessLayer;

namespace ServiceLayer.Entity
{
    [DataContract]
    public class CategoryW
    {
        int categoryID;
        string categoryName;

        [DataMember]
        public int CategoryID
        {
            get { return categoryID; }
            set { categoryID = value; }
        }

        [DataMember]
        public string CategoryName
        {
            get { return categoryName; }
            set { categoryName = value; }
        }

        public static CategoryW convert(Category category)
        {
            CategoryW u = new CategoryW();

            u.CategoryID = category.CategoryID;
            u.CategoryName = category.CategoryName;

            return u;
        }

        public static List<CategoryW> convertList(List<Category> list)
        {
            List<CategoryW> listW = new List<CategoryW>();

            foreach (Category x in list)
            {
                listW.Add(convert(x));
            }
            return listW;
        }
    }
}